package com.song.module.app.controller;


import com.song.common.result.R;
import com.song.framework.annotation.RateLimiter;
import com.song.module.admin.entity.ApChef;
import com.song.module.admin.request.ApChefRequest;
import com.song.module.admin.request.AppChefRequest;
import com.song.module.admin.service.IApChefService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 厨师控制层
 *
 * @author song
 * @date 2024-03-06
 */
@Slf4j
@AllArgsConstructor
@RestController
@Api(value = "厨师接口管理", tags = "厨师接口管理")
@RequestMapping("/app/apChef")
public class AppChefController {

    private final IApChefService iApChefService;

    /**
     * 查询厨师列表
     */
    @ApiOperation(value = "查询厨师列表")
    @PostMapping("/list")
    public R<List<ApChef>> pageList(@RequestBody ApChefRequest apChefRequest) {
        return R.success(iApChefService.list(apChefRequest));
    }

    /**
     * 获取厨师详细信息
     */
    @ApiOperation(value = "获取厨师详细信息")
    @GetMapping(value = "/query")
    public R<ApChef> detail(Integer id) {
        return R.success(iApChefService.getById(id));
    }


    /**
     * 厨师认证
     */
    @RateLimiter
    @ApiOperation(value = "厨师认证")
    @PostMapping("/verify")
    public R<Void> verify(@Validated @RequestBody AppChefRequest apChefRequest) {
        iApChefService.verify(apChefRequest);
        return R.success();
    }



}
